<include file="Public/header" title="基本信息-机构注册" />
<script type="text/javascript" src="__PUBLIC__/js/Validform_v5.3.2_min.js"></script>
<link href="__PUBLIC__/css/validform.css" rel="stylesheet">
<div class="main">
    <div class="wrap">
        <ul class="nav-bar">
            <li class="active"><span>基本信息</span><i></i></li>
            <li><span>验证邮箱</span><i></i></li>
            <li><span>信息登记</span><i></i></li>
        </ul>
        <div class="content ">
            <form action="{:U('regAction')}" method="post" class="form">
                {__TOKEN__}
            <div>每个邮箱仅能申请一种账号</div>
            <ul>
                <li>
                    <div class="label Validform_label">邮箱</div>
                    <input type="text" name="email" class="info">
                    <span class="Validform_checktip"></span>
                </li>
                <li>
                    <div class="label">设置密码</div>
                    <input type="password" name="password" class="info">
                    <span class="Validform_checktip"></span>
                </li>
                <li>
                    <div class="label">确认密码</div>
                    <input type="password" name="repassword" class="info">
                    <span class="Validform_checktip"></span>
                </li>
                <li class="last">
                    <div class="label Validform_label">验证码</div>
                    <input type="text" name="code" class="code" maxlength="4">
                    <img src="{:U('Public/valiCode')}" width="100%" id="valiCode" alt="">
                    <a href="javascript:void(0)" class="change" id="change">换一张</a>
                    <span class="Validform_checktip"></span>
                </li>
            </ul>
            <!--button 激活状态 .active-->
            <button type="submit" class="btn submit active">下一步</button>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $("#change").click(function(){
        var time=new Date();
        $("#valiCode").attr("src","{:U('Public/valiCode')}?ver="+time.getTime());
        $(".code").get(0).validform_valid="false";
        $(".code").nextAll('.Validform_checktip').removeClass('Validform_right').addClass('Validform_wrong').html('验证码错误！');
    })

    var valiForm=$("form").Validform({
        tiptype:3,
        showAllError:true,
        postonce:true,
    });

    valiForm.addRule([
        {
            ele:".info:eq(0)",
            datatype:"e",
            ajaxurl:"{:U('Org/queryEmail')}"
        },
        {
            ele:".info:eq(1)",
            datatype:"*6-20",
            nullmsg:"请设置6-20位密码"
        },
        {
            ele:".info:eq(2)",
            datatype:"*6-20",
            recheck:"password",
            nullmsg:"请重新输入密码",
            errormsg:"两次输入的密码不一致"
        },
        {
            ele:".code",
            datatype:"*4-4",
            errormsg:"验证码错误！",
            ajaxurl:"{:U('Public/checkCode')}"
        }
    ]);

</script>
<include file="Public/footer" />